<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui">

    <h:form id="DossierMedicalListForm">

        <p:panel header="#{bundle.ListDossierMedicalTitle}">

            <p:dataTable id="datalist" value="#{dossierMedicalController.items}" var="item"
                         selectionMode="single" selection="#{dossierMedicalController.selected}"
                         rowKey="#{item.idDossier}"
                         paginator="true"
                         rows="5"
                         rowsPerPageTemplate="5,10,20,30"
                         >

                <p:ajax event="rowSelect"   update="createButton viewButton editButton deleteButton"/>
                <p:ajax event="rowUnselect" update="createButton viewButton editButton deleteButton"/>

                <p:column sortBy="#{item.idDossier}" filterBy="#{item.idDossier}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDossierMedicalTitle_idDossier}"/>
                    </f:facet>
                    <h:outputText value="#{item.idDossier}"/>
                </p:column>
                <p:column sortBy="#{item.identite}" filterBy="#{item.identite}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDossierMedicalTitle_identite}"/>
                    </f:facet>
                    <h:outputText value="#{item.identite}"/>
                </p:column>
                <p:column sortBy="#{item.dateDossier}" filterBy="#{item.dateDossier}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDossierMedicalTitle_dateDossier}"/>
                    </f:facet>
                    <h:outputText value="#{item.dateDossier}">
                        <f:convertDateTime pattern="MM/dd/yyyy" />
                    </h:outputText>
                </p:column>
                <p:column sortBy="#{item.histoireMaladie}" filterBy="#{item.histoireMaladie}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDossierMedicalTitle_histoireMaladie}"/>
                    </f:facet>
                    <h:outputText value="#{item.histoireMaladie}"/>
                </p:column>
                <p:column sortBy="#{item.conclusionClinique}" filterBy="#{item.conclusionClinique}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDossierMedicalTitle_conclusionClinique}"/>
                    </f:facet>
                    <h:outputText value="#{item.conclusionClinique}"/>
                </p:column>
                <p:column sortBy="#{item.idPersonne.idPersonne}" filterBy="#{item.idPersonne.idPersonne}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListDossierMedicalTitle_idPersonne}"/>
                    </f:facet>
                    <h:outputText value="#{item.idPersonne.idPersonne}"/>
                </p:column>
                <f:facet name="footer">
                    <p:commandButton id="createButton" icon="ui-icon-plus"   value="#{bundle.Create}" actionListener="#{dossierMedicalController.prepareCreate}" update=":DossierMedicalCreateForm" oncomplete="DossierMedicalCreateDialog.show()"/>
                    <p:commandButton id="viewButton"   icon="ui-icon-search" value="#{bundle.View}" update=":DossierMedicalViewForm" oncomplete="DossierMedicalViewDialog.show()" disabled="#{empty dossierMedicalController.selected}"/>
                    <p:commandButton id="editButton"   icon="ui-icon-pencil" value="#{bundle.Edit}" update=":DossierMedicalEditForm" oncomplete="DossierMedicalEditDialog.show()" disabled="#{empty dossierMedicalController.selected}"/>
                    <p:commandButton id="deleteButton" icon="ui-icon-trash"  value="#{bundle.Delete}" actionListener="#{dossierMedicalController.delete}" update=":growl,datalist" disabled="#{empty dossierMedicalController.selected}"/>
                </f:facet>

            </p:dataTable>

        </p:panel>

    </h:form>

</ui:composition>